Difference between if and switch statements

      if								switch
1. it is a conditional statement	   1. it is a conditional statement

2. Supports all logical and 		   2. doesnot support logical and 	
comparision operators                         comparision operators

3. It is slow compare to switch        3. It is fast compare to if bcoz it
bcoz it check every statement                directly switch to the matching 
until it gets the matching one				 statement

4. break keyword is not required	   4. break keyword is required

5. else is used to validate the		   5. default is used to validate the 
non-matching statement					  non-matching statement

6. Example				  			   6. Example
   if(<condition>)                        switch(<condition>)
   {                                      {
       <statement>;                           case <value1>:
   }else{                                        <statement>;
       <invalid statement>;                      break;
   }                                          default:         
                                                 <invalid statement>;
                                          }